﻿// ***********************************************************************
// Assembly         : CommonLayer
// Author           : Lolo
// Created          : 06-16-2013
//
// Last Modified By : Lolo
// Last Modified On : 10-26-2013
// ***********************************************************************
// <copyright file="Environment.cs" company="Innovacall">
//     Copyright (c) Innovacall. All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using InnovaApp.Layers.ResourcesLayer.Properties;
using INNOVACALL.Framework.Common.Models.ViewModels.MetaModels;
using System.Globalization;
using System.Threading;
using InnovaApp.Layers.CommonLayer.Models.ViewModels.LayoutViewModels;
using INNOVACALL.Framework.Common;

namespace InnovaApp.Layers.CommonLayer.Controllers
{
    /// <summary>
    /// Class Environment.
    /// </summary>
    public static class CommonEnvironment
    {
        static string eMethodBase = "InnovaApp.Layers.CommonLayer.Controllers.Environment";


        /// <summary>
        /// Default language, returns en-us if AppSetting not set
        /// </summary>
        public static string DefaultLanguage
        {
            get
            {
                string toReturn = "en-us"; //Light Grey
                try
                {
                    toReturn = ConfigurationManager.AppSettings["DefaultLanguage"];
                }
                catch (Exception) { };
                return toReturn;
            }
        }
        /// <summary>
        /// Gets the languages.
        /// </summary>
        /// <value>The languages.</value>
        public static string Languages
        {
            get
            {
                return ConfigurationManager.AppSettings["Languages"];
            }
        }
        /// <summary>
        /// Gets the name of the IIS application.
        /// </summary>
        /// <value>The name of the IIS application.</value>
        public static string IISApplicationName
        {
            get
            {
                string toReturn = ConfigurationManager.AppSettings["IISApplicationName"];
                return toReturn;
            }
        }
        /// <summary>
        /// Gets the name of the SiteLayout
        /// </summary>
        /// <value>The name of the SiteLayout</value>
        public static enSiteLayouts SiteLayout
        {
            get
            {
                enSiteLayouts toReturn = EnumTools.EnumTypeTo<enSiteLayouts>(ConfigurationManager.AppSettings["SiteLayout"]);
                return toReturn;
            }
        }
        /// <summary>
        /// JQueryUI Theme, returns Smothness if AppSetting not set
        /// </summary>
        public static string JQueryUITheme
        {
            get
            {
                string toReturn = "Smoothness"; //Light Grey
                try
                {
                    toReturn = ConfigurationManager.AppSettings["JQueryUITheme"];
                }
                catch (Exception) { };
                return toReturn;
            }
        }
        /// <summary>
        /// Gets a value indicating whether [object query unique identifier rounded corners].
        /// </summary>
        /// <value><c>true</c> if [JQueryUIRoundedCorners]; otherwise, <c>false</c>.</value>
        public static bool JQueryUIRoundedCorners {
            get
            {
                bool toReturn = true;
                bool.TryParse(ConfigurationManager.AppSettings["JQueryUIRoundedCorners"],out toReturn);
                return toReturn;
            }
        }
        /// <summary>
        /// KendoUI Theme, returns Smothness if AppSetting not set
        /// </summary>
        public static string KendoUITheme
        {
            get
            {
                string toReturn = "Default"; //Light Grey
                try
                {
                    toReturn = ConfigurationManager.AppSettings["KendoUITheme"];
                }
                catch (Exception) { };
                return toReturn;
            }
        }
        /// <summary>
        /// Gets the site base URL.
        /// </summary>
        /// <value>The site base URL.</value>
        public static string SiteBaseUrl
        {
            get
            {
                string toReturn = string.Empty;
                toReturn = ConfigurationManager.AppSettings["SiteBaseUrl"];
                return toReturn;
            }
        }
        /// <summary>
        /// Languages list
        /// </summary>
        public static List<Language_MetaModel> LstLanguages
        {
            get
            {
                List<Language_MetaModel> toReturn;
                string eMethod = eMethodBase + "lstLanguages{get}";
                try
                {
                    toReturn = Languages.Split(',').Select(x => new Language_MetaModel(x)).ToList();
                }
                catch (Exception ex)
                {
                    throw new INNOVACALL.Framework.Common.InnovacallExceptions.InitializationException(eMethod, null, Resources.ErrMsg_Initialization_LanguageListError);
                }
                return toReturn;
            }
        }
        /// <summary>
        /// Dynamic content minimum height in pixels
        /// </summary>
        public static int ContentMinHeight
        {
            get
            {
                int toReturn = 600;
                int.TryParse(ConfigurationManager.AppSettings["ContentMinHeight"], out toReturn);
                return toReturn;
            }
        }

        /// <summary>
        /// Dynamic content minimum with in pixel
        /// </summary>
        public static int ContentMinWidth
        {
            get
            {
                int toReturn = 800;
                int.TryParse(ConfigurationManager.AppSettings["ContentMinWidth"], out toReturn);
                return toReturn;
            }
        }
        /// <summary>
        /// Gets the menu top margin.
        /// </summary>
        /// <value>The menu top margin.</value>
        public static int MenuTopMargin
        {
            get
            {
                int toReturn = 168;
                int.TryParse(ConfigurationManager.AppSettings["MenuTopMargin"], out toReturn);
                return toReturn;
            }
        }
        /// <summary>
        /// Base namespace to search dyna content controllers
        /// </summary>
        public static string DynaContentControllersBaseNamespace
        {
            get
            {

                string toReturn = string.Empty;
                toReturn = ConfigurationManager.AppSettings["DynaContentControllersBaseNamespace"];
                return toReturn;
            }
        }
        /// <summary>
        /// Base namespace to search controllers to add to the menu editor list
        /// </summary>
        public static string CustomControllersBaseNamespace
        {
            get
            {
                string toReturn = string.Empty;
                toReturn = ConfigurationManager.AppSettings["CustomControllersBaseNamespace"];
                return toReturn;
            }
        }
        /// <summary>
        /// Gets the upload path.
        /// </summary>
        /// <value>The upload path.</value>
        public static string UploadPath
        {
            get
            {
                string toReturn = string.Empty;
                toReturn = toReturn = ConfigurationManager.AppSettings["UploadPath"];
                return toReturn;
            }
        }
        /// <summary>
        /// Gets the upload path.
        /// </summary>
        /// <value>The upload path.</value>
        public static string UploadPhysicalPath
        {
            get
            {
                string toReturn = string.Empty;
                toReturn = toReturn = ConfigurationManager.AppSettings["UploadPhysicalPath"];
                return toReturn;
            }
        }
        /// <summary>
        /// Gets the user empty icon path.
        /// </summary>
        /// <value>The user empty icon path.</value>
        public static string UserEmptyIconPath
        {
            get
            {
                string toReturn = string.Empty;
                toReturn = toReturn = ConfigurationManager.AppSettings["UserEmptyIconPath"];
                return toReturn;
            }
        }
        /// <summary>
        /// Gets the user icons folder.
        /// </summary>
        /// <value>The user icons folder.</value>
        public static string UserIconsFolder
        {
            get
            {
                string toReturn = string.Empty;
                toReturn = toReturn = ConfigurationManager.AppSettings["UserIconsFolder"];
                return toReturn;
            }
        }
        /// <summary>
        /// Gets or sets the user icons physical path.
        /// </summary>
        /// <value>The user icons physical path.</value>
        public static string UserIconsPhysicalPath
        {
            get
            {
                string toReturn = string.Empty;
                toReturn = toReturn = ConfigurationManager.AppSettings["UserIconsPhysicalFolder"];
                return toReturn;
            }
        }
        /// <summary>
        /// Gets the CSS base path.
        /// </summary>
        /// <value>The CSS base path.</value>
        public static string CssBasePath
        {
            get
            {
                string toReturn = string.Empty;
                toReturn = toReturn = ConfigurationManager.AppSettings["CssBasePath"];
                return toReturn;
            }
        }
        /// <summary>
        /// Gets the default automatic compleate count.
        /// </summary>
        /// <value>The default automatic compleate count.</value>
        public static int DefaultAutoCompleateCount { get { return 15; } }
        /// <summary>
        /// Gets the account activation from mail address.
        /// </summary>
        /// <value>The account activation from mail address.</value>
        public static string AccountActivationFromMailAddress
        {
            get
            {
                string toReturn = string.Empty;
                toReturn = toReturn = ConfigurationManager.AppSettings["AccountActivationFromMailAddress"];
                return toReturn;
            }
        }
    }
}